﻿@model Cofoundry.Web.Identity.ChangePasswordViewModel
@inject IStaticResourceReferenceRenderer staticResourceReferenceRenderer
@inject IAdminRouteLibrary adminRouteLibrary

@{
    ViewBag.Title = "Change password";
    Layout = adminRouteLibrary.Auth.LoginLayoutPath;
    var returnUrl = Context.Request.Query["ReturnUrl"];
}

@section FooterScripts
{
    @staticResourceReferenceRenderer.ScriptTag(adminRouteLibrary.Auth, "Shared")
}

<h1>Change Password</h1>

<div class="wrap">
    @if (Context.Request.Method == "POST" && ViewData.ModelState.IsValid)
    {
        <form>
            <fieldset>

                <p>Your password has been updated.</p>

                <div class="actions">
                    <p>
                        <a href="@adminRouteLibrary.Auth.Login(returnUrl)">Click here to login</a>
                    </p>
                </div>

            </fieldset>
        </form>
    }
    else
    {
        <form class="form-horizontal" method="post" id="MainForm">
            <input name="returnUrl" id="ReturnUrl" type="hidden" value="@returnUrl" />

            <fieldset>
                <p class="message warning perm">
                    You must change your password before accessing the admin area.
                </p>

                <div class="control-group">
                    <label asp-for="Username" class="control-label"></label>
                    <div class="controls">
                        <input type="email" asp-for="Username" maxlength="150" tabindex="1" />
                        <span asp-validation-for="Username" class="help-block"></span>
                    </div>
                </div>

                <div class="control-group">
                    <label asp-for="OldPassword" class="control-label"></label>
                    <div class="controls">
                        <input type="password" asp-for="OldPassword" />
                        <span asp-validation-for="OldPassword" class="help-block"></span>
                    </div>
                </div>

                <div class="control-group">
                    <label asp-for="NewPassword" class="control-label"></label>
                    <div class="controls">
                        <input type="password" asp-for="NewPassword" maxlength="300" />
                        <span asp-validation-for="NewPassword" class="help-block"></span>
                    </div>
                </div>

                <div class="control-group">
                    <label asp-for="ConfirmNewPassword" class="control-label"></label>
                    <div class="controls">
                        <input type="password" asp-for="ConfirmNewPassword" maxlength="300" />
                        <span asp-validation-for="ConfirmNewPassword" class="help-block"></span>
                    </div>
                </div>

                <div class="actions">
                    <input type="submit" class="btn btn-primary" value="Change password" />
                </div>

            </fieldset>
        </form>
    }
    </div>

<footer class="login-footer">

</footer>